﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(GameCameraDrag))]
public class GameCameraDragEditor : Editor
{
   private void OnEnable()
   {
      
   }

   public override void OnInspectorGUI()
   {
     // base.OnInspectorGUI();
      SerializedProperty _moveType = serializedObject.FindProperty("_moveType");  
      SerializedProperty _drag = serializedObject.FindProperty("_drag");
      EditorGUI.BeginChangeCheck();
      EditorGUILayout.PropertyField(_moveType);
      if (EditorGUI.EndChangeCheck())
      {
          if (_moveType.enumValueIndex== (int)GameCameraDrag.MoveType.SmoothDamp)
          {
              _drag.managedReferenceValue = new CameraDragSmoothDamp();
          }
          else
          {
              _drag.managedReferenceValue = new CameraDragByCurve();
          }
          serializedObject.ApplyModifiedProperties();
      }
      EditorGUI.BeginChangeCheck();
      EditorGUILayout.PropertyField(_drag,true);
      if (EditorGUI.EndChangeCheck())
      {
          serializedObject.ApplyModifiedProperties();

      }
   }
}
